package com.hx.mapper;

import com.hx.pojo.Emp;
import com.hx.pojo.Emp1;
import com.hx.pojo.Student;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

//定义映射接口
public interface EmpMapper {
    //定义操作数据库的功能方法
    //查寻所有数据
    List<Emp> findAll();

    //插入一条数据
    int addEmp(Emp emp);

    int updateEmp(Emp emp);

    int deleteID(int emp);

    List<Student> fiall();

    //根据ename获取emp信息
    Emp findEmpByEname1(String ename);
    Emp findEmpByEname2(String ename);

    //
    Emp finEmpByEnameAndJob(@Param("name")String ename,@Param("job")String job);

    Emp findEmpByMap(Map<String,String> map);

    //根据id查询一个实体类
    Emp queryEmpById(@Param("empon") int id);

    //查询结果存放在list集合中
    List<Emp> queryAllEmp();

    //计数
    int getCount();

    Map<Object,Object> getUserByIdToMap(@Param("empon") Integer empon);

    List<Map<Object,Object> > getAllUserToListMap();

    @MapKey("empon")
    Map<Object,Object> finAllEmpPutListMap();

    List<Emp> getUserByLike(@Param("ename")String ename);

    List<Emp> getUserByLike1(@Param("ename")String ename);

    List<Emp> getUserByLike3(@Param("ename")String ename);

    List<Emp> getUserByLike4(@Param("ename")String ename);

    //2.批量删除：删除的多条数据，根据主键
    Integer deleteEmpByIds(@Param("empons") String empons);

    List<Emp> getAllEmpByTableName(@Param("emp") String tablename);

    //新增数据返回记录的主键
    int saveEmp(Emp emp);

    List<Emp> findAllEmp();

    Emp1 getEmpAndDept(@Param("empon") Integer empon);

    Emp1 getEmpAndDepy1(@Param("empon") Integer empon);

    Emp1 selectEmpFromDeptByEmpno1(@Param("empon") int empon);

    Emp deptAndEmpResultMap(@Param("depton") Integer depton);

    List<Emp> qureEmpByMoreConditions(@Param("empon") Integer empon,@Param("ename") String name,@Param("job") String job);
    //if
    List<Emp>qureEmpByMoreConditions1(@Param("empon") int empon,@Param("ename") String name,@Param("job") String job);

    //多条件查询where
    List<Emp> queryEmpByMoreConditions2(@Param("emp") Emp emp);

    //
    List<Emp> queryEmpByMoreConditions3(@Param("emp") Emp emp);
    List<Emp> queryEmpByMoreConditions4(@Param("emp") Emp emp);

    //
    List<Emp> getEmpByChoose(Emp emp);

    int insertMoreEmp(@Param("empList") List<Emp> empList);
    int insertMoreEmp1(@Param("empList") List<Emp> empList);


    int deleteMoreEmpByIds(@Param("empons")Integer[] empons);

    int deleteMoreEmpByIds2(@Param("empons")Integer[] empons);
}
